9d24dfa0c788caae2d75004bd31db969d36cc1a9,app/src/main/java/zlc/season/rxdownloadproject/service_download/ServiceDownloadActivity.java,ServiceDownloadActivity,installApk,#,127

Before Change


    }

    private void installApk() {
        Uri uri = Uri.fromFile(mRxDownload.getRealFiles(url)[0]);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        intent.setDataAndType(uri, "application/vnd.android.package-archive");

After Change


    }

    private void installApk() {
        File[] files = mRxDownload.getRealFiles(url);
        if (files != null) {
            Uri uri = Uri.fromFile(files[0]);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            intent.setDataAndType(uri, "application/vnd.android.package-archive");
            startActivity(intent);
        } else {
            Toast.makeText(this, "File not exists", Toast.LENGTH_SHORT).show();
        }
    }
}